var async = require("async");
var renderEngin = require("../common/renderEngin");
var Tools = require("../common/tools");
exports.notification = function(req, res) {
    use(["public/javascripts/notification/init.js", "public/javascripts/service/notificationService.js"], function(PageComponent, notificationService) {
        var storage = {};
        storage["slider"] = Tools.getPageSliderData("user_center");
        notificationService.getNoticeList({headers: req.headers, urlParams: {isAsc: false}}, function (result) {
            if (result.errorCode == 0) {
                storage["noticeList"] = result;
                storage["list"] = result.data;
                storage["totalResult"] = result.pagination.totalResult;
            } else {
                storage["noticeList"] = {};
                storage["list"] = [];
                storage["totalResult"] = 0;
            }

            PageComponent = React.createFactory(PageComponent);
            renderEngin.call(res, 'notification', PageComponent, storage);
        });
    });
}
